package com.x8.mt.service;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.x8.mt.dao.IMetadata_relationtableDao;
import com.x8.mt.entity.Metadata_relationtable;

@Service
public class Metadata_relationtableService {
	@Resource
	IMetadata_relationtableDao iMetadata_relationtableDao;

	public boolean insertMetadata_relationtable(
			Metadata_relationtable metadata_relationtable) {
		try {
			return iMetadata_relationtableDao.insert(metadata_relationtable) > 0 ? true
					: false;
		} catch (Exception e) {
			return false;
		}
	}

	public Metadata_relationtable getMetadata_relationtableByid(int id) {
		try {
			return iMetadata_relationtableDao.getMetadata_relationtableByid(id);
		} catch (Exception e) {
			return null;
		}
	}

	public List<Metadata_relationtable> getMetadata_relationtableBydatasourceid(
			int datasourceid) {
		try {
			return iMetadata_relationtableDao
					.getMetadata_relationtableBydatasourceid(datasourceid);
		} catch (Exception e) {
			return null;
		}
	}

	public Metadata_relationtable getMetadata_relationtableByName(String name) {
		try {
			return iMetadata_relationtableDao
					.getMetadata_relationtableByName(name);
		} catch (Exception e) {
			return null;
		}
	}

	/**
	 * 
	 * 作者:itcoder
	 * 时间:2017年12月11日
	 * 作用:模糊查询metadata_relationtable表
	 */
	public List<Metadata_relationtable> getMetadata_relationtableByLike(String name) {
		try {
			return iMetadata_relationtableDao.getMetadata_relationtableByLike(name);
		} catch (Exception e) {
			return null;
		}
	}

	public boolean updateRelationtable(Metadata_relationtable metadata_relationtable) {
		return iMetadata_relationtableDao.updateMetadata_relationtable(metadata_relationtable);
	}

	public boolean deleteMetadata_relationtable(int id) {
		return iMetadata_relationtableDao.deleteMetadata_relationtable(id);
	}
}
